package com.aizuda.encrypt.config;

import com.aizuda.encrypt.entity.TableRule;
import com.aizuda.encrypt.enums.EncryptType;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 主配置文件
 *
 * @author nn200433
 * @date 2024-03-22 05:18:43
 */
@Data
@ConfigurationProperties(prefix = EncryptProperties.ENCRYPT_CONFIG_PREFIX)
public class EncryptProperties {

    public static final String                 ENCRYPT_CONFIG_PREFIX    = "mybatis.encrypt";
    /** 忽视加密的sql关键字 */
    private             String[]               ignoreEncryptSqlKeyWords = new String[]{
            "sys_operation_log", "alter table"
    };
    /** 是否对like表达式进行转义 */
    private             Boolean                isLikeExpressionEscape   = Boolean.FALSE;
    /** 密钥 */
    private             String                 encryptKey;
    /** 加密方式 */
    @NestedConfigurationProperty
    private             EncryptType            encryptType;
    /** 表 */
    @NestedConfigurationProperty
    private             Map<String, TableRule> tables = new LinkedHashMap<String, TableRule>();

}
